home *** CD-ROM | disk | FTP | other *** search
/ HamCall (April 1991) / HAMCALL CD-ROM (Buckmaster)(April 1991).BIN / prgming / ctutor / backward.c < prev    next >
Text File  |  1990-10-14  |  758b  |  38 lines

  1.                                          /* Chapter 5 - Program 6 */
  2. #include "stdio.h"      /* Prototypes for standard Input/Output   */
  3. #include "string.h"     /* Prototypes for string operations       */
  4.  
  5. void forward_and_backwards(char line_of_char[],int index);
  6.  
  7. main()
  8. {
  9. char line_of_char[80];
  10. int index = 0;
  11.  
  12.    strcpy(line_of_char,"This is a string.\n");
  13.  
  14.    forward_and_backwards(line_of_char,index);
  15.  
  16. }
  17.  
  18. void forward_and_backwards(char line_of_char[],int index)
  19. {
  20.    if (line_of_char[index]) {
  21.       printf("%c",line_of_char[index]);
  22.       index++;
  23.       forward_and_backwards(line_of_char,index);
  24.    }
  25.    printf("%c",line_of_char[index]);
  26. }
  27.  
  28.  
  29.  
  30.  
  31. /* Result of execution
  32.  
  33. This is a string.
  34.  
  35. .gnirts a si sih
  36.  
  37. */
  38.